{// 引入标签库 }
<tagLib name="html" />
{// 加载头部公共文件 }
<include file="Public:top" />
<!-- 菜单区域  -->

<!-- 主页面开始 -->
<div id="main" class="" >

<!-- 主体内容  -->
<div class="content" >
<!--  <div class="title">导入学生分数数据页面</div>-->
<!--  功能操作区域  -->
<div class="operate" >

</div>
<!-- 功能操作区域结束 -->
<style>
#clist li,#clist1 li{width: 60px; float:left; height: 26px; line-height: 26px; padding: 2px}
#clist1 ul,#clist ul{display:block; width: 100%; float: left;}
#clist1 dd,#clist dd{display:block; width: 100%; float: left; height: 26px; line-height: 26px;font-weight: bold; font-size: 14px; padding: 10px 0px 0px 0px;}
#ul_knowledgeclass li{float: left; width: 450px;}
#ul_knowledgeclass .i1{width: 340px; height: 40px; float: left; padding: 2px; margin: 10px;}
#ul_knowledgeclass .s1{width: 80px; height: 40px;float: left; line-height: 48px; text-align: right;}
#form2 tr{height: 28px; padding: 5px;}
#list4 ul li {float: left; padding: 3px 10px;}
#list4 ul {display:block; width: 100%; float: left;}
#tmmain li{height: 26px; line-height: 26px;margin: 0px 5px;}
.title1{font-weight: bold;font-size: 14px;}
</style>
<!-- 主体显示区域  -->
<div>
<form method="post" id="form2" name="form2" action="__URL__/update/">
<table width="90%" cellpadding=3 cellspacing=3>
	<tr>
		<td class="tRight" >试卷名称：</td>
		<td class="tLeft" width="200px"><input type="text" class="huge bLeftRequire" name="exName" value="{$vo.exName}" title=""></td>
		<td class="tRight" width="100px">科目：</td>
		<td class="tLeft">
			<html:tableSel style="select" name="subjectid" id="subjectid" value="$vo.subjectid" datasource="subject" />
		</td>
		<td class="tRight">小题数：</td>
		<td class="tLeft" ><input type="number" size="3" min="3" class="small bLeftRequire easyui-numberbox" name="exCount" id="exCount" value="{$vo.exCount}" title=""></td>
	</tr>
	<tr>
		<td class="tRight">知识等级序列：</td>
		<td><input type="text" class="huge bLeftRequire" name="knowledgeRank" id="knowledgeRank" value="{$vo.knowledgeRank}" title=""></td>
		<td class="tRight">能力等级序列：</td>
		<td colspan="3"><input type="text" class="huge bLeftRequire" name="abilityRank" id="abilityRank" value="{$vo.abilityRank}" title=""></td>
	</tr>
	<tr>
		<td class="tRight" valign="top">知识点小题列表：</td>
		<td>
			<div  class="easyui-accordion" style="width:360px;height:350px;" id="voklist">
				<volist name="knowledge" id="vok">
					<div title="{$vok.display}" id="vokp{$vok.id}" data-vokid="{$vok.id}" data-voktitle="{$vok.display}" class="list1"></div>
				</volist>
			</div>
		</td>
		<td class="tRight" valign="top">能力点小题列表：</td>
		<td colspan="3">
			<div  class="easyui-accordion" style="width:360px;height:350px;">
				<volist name="ability" id="voa">
					<div title="{$voa.display}" id="voap{$voa.id}" data-voaid="{$voa.id}" data-voatitle="{$voa.display}" class="list2"></div>
				</volist>
			</div>	
		</td>
	</tr>
	<tr>
		<td colspan='6'  align="center"><br><br>
			<a href="#" class="easyui-linkbutton" iconCls="icon-ok" onclick="update()">save</a>
			<a href="#" class="easyui-linkbutton" iconCls="icon-no">remove</a>
		</td>
	</tr>
</table>
<!-- <input type="hidden" name="ajax" value="1"> -->
<input type="hidden" name="id" value="{$Think.get.id}">
<input type="hidden" name="knowledgeList" id="knowledgeList" value="{$vo.knowledgeList}">
<input type="hidden" name="abilityList" id="abilityList" value="{$vo.abilityList}">
<input type="hidden" name="exTitleList" id="exTitleList" value="{$vo.exTitleList}">
<input type="hidden" name="exCount1" id="exCount1" value="{$vo.exCount1}">
</form>
</div>

<!-- 用于显示隐藏的内容，弹出窗口等-->
<div class="hide">
    <div id="w" class="easyui-window" title="知识点小题分类选择" iconCls="icon-save" style="width:700px;height:400px;padding:5px;" closed="true">
		<div class="easyui-layout" fit="true">
			<div region="center" border="false" style="padding:10px;background:#fff;border:1px solid #ccc;">
				<ul id='clist'>
					<li><input type="checkbox"/>小题1</li><li><input type="checkbox"/>小题1</li>
				</ul>
			</div>
			<div region="south" border="false" style="text-align:right;padding:5px 0; height:35px">
				<a class="easyui-linkbutton" iconCls="icon-ok" href="javascript:void(0)" onclick="submit1()">确认</a>
				<a class="easyui-linkbutton" iconCls="icon-cancel" href="javascript:void(0)" onclick="close1()">关闭</a>
			</div>
		</div>
	</div>

	<div id="ww" class="easyui-window" title="能力点小题分类选择" iconCls="icon-save" style="width:700px;height:400px;padding:5px;" closed="true">
		<div class="easyui-layout" fit="true">
			<div region="center" border="false" style="padding:10px;background:#fff;border:1px solid #ccc;">
				<div id='clist1'>
					<li><input type="checkbox"/>小题1</li><li><input type="checkbox"/>小题1</li>
				</div>
			</div>
			<div region="south" border="false" style="text-align:right;padding:5px 0; height:35px">
				<a class="easyui-linkbutton" iconCls="icon-ok" href="javascript:void(0)" onclick="submit11()">确认</a>
				<a class="easyui-linkbutton" iconCls="icon-cancel" href="javascript:void(0)" onclick="close1()">关闭</a>
			</div>
		</div>
	</div>

	<!-- 以下用于显示等级序列窗口 -->
	<div id="w2" class="easyui-window" title="知识等级选择" iconCls="icon-save" style="width:510px;height:290px;padding:5px;" closed="true">
		<div class="easyui-layout" fit="true">
			<div region="center" border="false" style="padding:10px;background:#fff;border:1px solid #ccc;">
				<ul id="ul_knowledgeclass">
            		<li>
						<dd class='s1'>不熟练：</dd>
						<dd class='i1'><input class="easyui-slider" name="bsl" id="bsl" value="20" style="width:300px" data-options="showTip: true,  
			                rule: [0,'|',25,'|',50,'|',75,'|',100],  
			                tipFormatter: function(value){  
			                    return value+'%';  
			            }">
			        	</dd>
            		</li>
            		<li>
						<dd class='s1'>基本熟练：</dd>
						<dd class='i1'><input class="easyui-slider" name="jbsl" id="jbsl" value="67" style="width:300px" data-options="showTip: true,  
			                rule: [0,'|',25,'|',50,'|',75,'|',100],  
			                tipFormatter: function(value){  
			                    return value+'%';  
			            }">
			        	</dd>
            		</li>
            		<li>
						<dd class='s1'>熟练：</dd>
						<dd class='i1'><input class="easyui-slider" name="sl" id="sl" value="10" style="width:300px" data-options="showTip: true,  
			                rule: [0,'|',25,'|',50,'|',75,'|',100],  
			                tipFormatter: function(value){  
			                    return value+'%';  
			            }">
			        	</dd>
            		</li>
				</ul>
			</div>
			<div region="south" border="false" style="text-align:right;padding:5px 0; height:35px">
				<a class="easyui-linkbutton" iconCls="icon-ok" href="javascript:void(0)" onclick="submit2()">确认</a>
				<a class="easyui-linkbutton" iconCls="icon-cancel" href="javascript:void(0)" onclick="close1()">关闭</a>
			</div>
		</div>
	</div>

	<!-- 以下用于显示等级序列窗口 -->
	<div id="w3" class="easyui-window" title="能力等级选择" iconCls="icon-save" style="width:510px;height:290px;padding:5px;" closed="true">
		<div class="easyui-layout" fit="true">
			<div region="center" border="false" style="padding:10px;background:#fff;border:1px solid #ccc;">
				<ul id="ul_knowledgeclass">
            		<li>
						<dd class='s1'>不熟练：</dd>
						<dd class='i1'><input class="easyui-slider" name="bsl1" id="bsl1" value="20" style="width:300px" data-options="showTip: true,  
			                rule: [0,'|',25,'|',50,'|',75,'|',100],  
			                tipFormatter: function(value){  
			                    return value+'%';  
			            }">
			        	</dd>
            		</li>
            		<li>
						<dd class='s1'>基本熟练：</dd>
						<dd class='i1'><input class="easyui-slider" name="jbsl1" id="jbsl1" value="67" style="width:300px" data-options="showTip: true,  
			                rule: [0,'|',25,'|',50,'|',75,'|',100],  
			                tipFormatter: function(value){  
			                    return value+'%';  
			            }">
			        	</dd>
            		</li>
            		<li>
						<dd class='s1'>熟练：</dd>
						<dd class='i1'><input class="easyui-slider" name="sl1" id="sl1" value="10" style="width:300px" data-options="showTip: true,  
			                rule: [0,'|',25,'|',50,'|',75,'|',100],  
			                tipFormatter: function(value){  
			                    return value+'%';  
			            }">
			        	</dd>
            		</li>
				</ul>
			</div>
			<div region="south" border="false" style="text-align:right;padding:5px 0; height:35px">
				<a class="easyui-linkbutton" iconCls="icon-ok" href="javascript:void(0)" onclick="submit3()">确认</a>
				<a class="easyui-linkbutton" iconCls="icon-cancel" href="javascript:void(0)" onclick="close1()">关闭</a>
			</div>
		</div>
	</div>

<!-- 	以下w4窗口用于显示弹出窗口，小题级小题结构的显示，自动统计小题数量 -->
	<div id="w4" class="easyui-window" title="小题结构及数量设置" iconCls="icon-save" style="width:550px;height:300px;padding:5px;" closed="true">
		<div class="easyui-layout" fit="true">
			<div region="center" border="false" style="padding:10px;background:#fff;border:1px solid #ccc;" id='list4'>
				<ul>
					<li>大题数量：<input type="number" size="2" min="1" class="small bLeftRequire easyui-numberbox" name="exCount111" id="exCount111" value="{$vo.exCount1}" title=""></li><li>小题总数：<input type="text" id="excount11" name="excount11" value="{$vo.exCount}"/></li>
				</ul>
				<div id="tmmain">
				  <ul>
					<li class="title1">第一大题<input type="text" class="medium bLeftRequire" name="dttm1" id="dttm1" ></li><li>(小题数量:<input type="number" size="2" min="1" class="tiny bLeftRequire easyui-numberbox xts" name="xtsl1" id="xtsl1" >)</li>
				  </ul>
				</div>
			</div>
			<div region="south" border="false" style="text-align:right;padding:5px 0; height:35px">
				<a class="easyui-linkbutton" iconCls="icon-ok" href="javascript:void(0)" onclick="submit4()">确认</a>
				<a class="easyui-linkbutton" iconCls="icon-cancel" href="javascript:void(0)" onclick="close1()">关闭</a>
			</div>
		</div>
	</div>
</div>
<!-- 隐藏窗口代码结束 -->


<script type="text/javascript">
$(function() {
	//拆分读取知识小题列表
	var knl 	= $("#knowledgeList").val();
	var knls 	= knl.split(';');
	var knlss	= new Array();
	if(knls.length>0){
		var objs = new Array();
		objs =$(".list1");
		//将小题与各知识点的列表读取出，先通过';'分组出各知识点的序列，再通过'#'分组出各知识点
		//id#知识点名称#小题号列表，由此产生对应关系。
		$.each(knls, function(i,val){      
	    	knlss = val.split('#');
	    	objs.each(function(i){
	            //vokid表示知识点id号
	            if($(this).data('vokid')==knlss[0]){
	            	//如果继续将knlss[2]用','split将产生一个所有小题号的数组
	            	$(this).html(knlss[2]);
	            }
	        });
	  	}); 
  	} //if

  	//拆分读取能力小题列表
  	var abl 	= $("#abilityList").val();
	var abls 	= abl.split(';');
	var ablss	= new Array();
	if(abls.length>0){
		var objs = new Array();
		objs =$(".list2");
		//将小题与各知识点的列表读取出，先通过';'分组出各知识点的序列，再通过'#'分组出各知识点
		//id#知识点名称#小题号列表，由此产生对应关系。
		$.each(abls, function(i,val){      
	    	ablss = val.split('#');
	    	objs.each(function(i){
	            //voaid表示能力点id号
	            if($(this).data('voaid')==ablss[0]){
	            	//如果继续将knlss[2]用','split将产生一个所有小题号的数组
	            	$(this).html(ablss[2]);
	            }
	        });
	  	}); 
  	} //if

  	//给小题列表添加双击事件//知识点
  	$('.list1').dblclick(function(){
  		var exCount = $('#exCount').val();
  		var xtlist	= ','+$(this).html()+',';
  		var vokid 	= $(this).data('vokid');
  		var output	= "<ul>",t;
  		var cxtl	= $('#exTitleList').val();
  		var cxtl1	= cxtl.split(';');
  		var cxtl11	= cxtl1[0].split(',');  //各大题的小题数
  		var cxtl12	= cxtl1[1].split(',');  //各大题的标题 
  		var exCount1= $('#exCount1').val();
  		var curC	= 0; //用于记数,记录大题标
  		var curCc	= 0; //用于记数，记录小题标

  		output += '<dd>第1大题:'+cxtl12[0]+'</dd>';

  		for(var i=0;i<exCount;i++){
  			t=i+1;
  			t=','+t+',';
  			curCc++;
  			if(xtlist.indexOf(t)>-1){
  				output += '<li>小题'+(i+1)+'<input type="checkbox" value="'+ (i+1) +'" checked/></li>';
  			}else{
  				output += '<li>小题'+(i+1)+'<input type="checkbox" value="'+ (i+1) +'"/></li>';
  			}
  			if(curCc==cxtl11[curC] && curC<exCount1-1){
  				output += '</ul><ul><dd>第'+(curC+2)+'大题:'+cxtl12[curC+1]+'</dd>';
  				curC++;
  				curCc=0;
  			}
  		}
  		$('#clist').data('vokid',vokid)
  		$('#clist').html(output+"</ul>");
  		$('#w').window('open');
  	})
  	//给小题列表添加双击事件//能力点
  	$('.list2').dblclick(function(){
  		var exCount = $('#exCount').val();
  		var xtlist	= ','+$(this).html()+',';
  		var voaid 	= $(this).data('voaid');
  		var output="<ul>",t;
  		var cxtl	= $('#exTitleList').val();
  		var cxtl1	= cxtl.split(';');
  		var cxtl11	= cxtl1[0].split(',');  //各大题的小题数
  		var cxtl12	= cxtl1[1].split(',');  //各大题的标题 
  		var exCount1= $('#exCount1').val();
  		var curC	= 0; //用于记数,记录大题标
  		var curCc	= 0; //用于记数，记录小题标

  		output += '<dd>第1大题:'+cxtl12[0]+'</dd>';

  		for(var i=0;i<exCount;i++){
  			t=i+1;
  			t=','+t+',';
  			curCc++;
  			if(xtlist.indexOf(t)>-1){
  				output += '<li>小题'+(i+1)+'<input type="checkbox" value="'+ (i+1) +'" checked/></li>';
  			}else{
  				output += '<li>小题'+(i+1)+'<input type="checkbox" value="'+ (i+1) +'"/></li>';
  			}
  			if(curCc==cxtl11[curC] && curC<exCount1-1){
  				output += '</ul><ul><dd>第'+(curC+2)+'大题:'+cxtl12[curC+1]+'</dd>';
  				curC++;
  				curCc=0;
  			}
  		}
  		$('#clist1').data('voaid',voaid);
  		$('#clist1').html(output+"</ul>");
  		$('#ww').window('open');
  	})

  	//给知识等级添加单击事件
  	$('#knowledgeRank').click(function(){
  		$('#w2').window('open');
  	})
  	//给能力等级添加单击事件
  	$('#abilityRank').click(function(){
  		$('#w3').window('open');
  	})
  	//给小题数量添加单击事件
  	$('#exCount').click(function() {
  		$('#w4').window('open');
  	});
  	//当大题数量发生变化时改变框数
  	$('#exCount111').blur(function() {
  		var exc = $('#exCount111').val();
  		var op 	= '';
  		for(var i = 0;i<exc;i++){
  			op += '<ul><li class="title1">第'+ (i+1) +'大题<input type="text" class="medium bLeftRequire dttm" name="dttm'+i+'" id="dttm'+i+'" ></li><li>(小题数量:<input type="number" size="2" min="1" class="tiny bLeftRequire easyui-numberbox xts" name="xts'+i+'" id="xts'+i+'" >)</li></ul>';
  		}
  		//$('#w4').height(exc*26+150);
  		$('#w4').window('resize',{
			height: (exc*29+150),
			width: 550
		});
  		$('#tmmain').html(op);
  	});//blur
  	//当修改各小题数时，修改小题数量输入框
  	$('.xts').live('blur', function() {
  		var excc = 0;
	  	$(".xts").each(function(){
	  		if($(this).val()>0){
	  			excc += parseInt($(this).val());
	  		}
	    });
	  	$('#exCount').val(excc);
	  	$('#excount11').val(excc);
	});

});//jquery/////////////////////////////////////////////////////////////////////////////////////////////////

function close1(){
	$('#w,#w2,#w3,#ww,#w4').window('close');
}
//提交checkbox窗口
function submit1(){
	var clistval='';
	var vokid 	= $('#clist').data('vokid');
	$('#clist input:checked').each(function(index) {
	    //if(typeof($(this).val())!=undefined){
	    	clistval += $(this).val()+',';
	    //}
	});
	$('#vokp'+vokid).html(clistval);
	$('#w').window('close');
	//将结果更新到隐藏域中，结串
		var objs = new Array();
		var output = "";
		objs =$(".list1");
	    objs.each(function(i){
	        output += $(this).data('vokid')+'#'+ $(this).data('voktitle') +'#'+$(this).html()+';';
	    });
	    $('#knowledgeList').val(output);
	slidemessage('列表修改成功！');
}
//提交checkbox窗口//能力
function submit11(){
	var clistval='';
	var voaid 	= $('#clist1').data('voaid');
	$('#clist1 input:checked').each(function(index) {
	    //if(typeof($(this).val())!=undefined){
	    	clistval += $(this).val()+',';
	    //}
	});
	$('#voap'+voaid).html(clistval);
	$('#ww').window('close');
	//将结果更新到隐藏域中，结串
		var objs = new Array();
		var output = "";
		objs =$(".list2");
	    objs.each(function(i){
	        output += $(this).data('voaid')+'#'+ $(this).data('voatitle') +'#'+$(this).html()+';';
	    });
	    $('#abilityList').val(output);

	slidemessage('列表修改成功！');
}
//提交知识等级窗口
function submit2(){
	var sl 		= $('#sl').val();
	var bsl		= $('#bsl').val();
	var jbsl	= $('#jbsl').val();
	$('#knowledgeRank').val('不熟练:'+bsl+'%;基本熟练:'+jbsl+'%;熟练:'+sl+'%;');
	$('#w2').window('close');
	slidemessage('等级百分比修改成功！');
}
//提交能力等级窗口
function submit3(){
	var sl 		= $('#sl1').val();
	var bsl		= $('#bsl1').val();
	var jbsl	= $('#jbsl1').val();
	$('#abilityRank').val('不熟练:'+bsl+'%;基本熟练:'+jbsl+'%;熟练:'+sl+'%;');
	$('#w3').window('close');
	slidemessage('等级百分比修改成功！');
}
//提交大题小题数量窗口
function submit4(){
	//111为大题数，11为小题数
	$('#exCount1').val($('#exCount111').val());
	$('#exCount').numberbox('setValue', $('#excount11').val());
	//生成extitlelist
	var op1 = '',op2='';
	$(".xts").each(function(){
		op1 += $(this).val()+',';
	})
	$(".dttm").each(function(){
		op2 += $(this).val()+',';
	})
	$('#exTitleList').val(op1+';'+op2);
	$('#w4').window('close');
	slidemessage('大题小题数量修改成功！');
}
//提交修改////////////////////////////
function update(){
	$("#form2").ajaxSubmit();
	slidemessage('数据保存成功！');
}
</script>